<div  ng-controller="products as at">
<section class="content-header">
	<h1>
		{{title}}<small></small>
	</h1>
</section>
<section class="content">
	<div class="box box-default">
		<div class="col-md-12">
			<div class="box-body">
				<alertdanger></alertdanger>
				<alertsuccess></alertsuccess>
				<form role="form">
					<div class="box-body">
						<div ng-show=lastgoodstypenameshow class="form-group">
							<label>商品类型</label>
							<input maxlength="20" required="required"
								ng-model="lastgoodstypename" class="form-control" type="text" readonly>
						</div>
						<div ng-show="modifygoodstypeshow" class="form-group">
							<button class="btn btn-default btn-block btn-sm" ng-click="clickmodifygoodstype();">修改商品类型</button>
						</div>

						<div ng-show="goodstypeshow" class="form-group" ng-init="findallgoodstype();">
							<label>商品类型</label> <select ng-change="goodstypechange();"
								ng-model="selectedgoodstype"
								ng-options="gs.name for gs in goodstypeselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>

						<div ng-show=lastbrandnameshow class="form-group">
							<label>品牌</label>
							<input maxlength="20" required="required"
								ng-model="lastbrandname" class="form-control" type="text" readonly>
						</div>
						<div ng-show="modifybrandnameshow" class="form-group">
							<button class="btn btn-default btn-block btn-sm" ng-click="clickmodifybrandname();">修改品牌</button>
						</div>

						<div ng-show="brandnameshow" class="form-group">
							<label>品牌</label> <select ng-change="brandchange();"
								ng-model="selectedbrands"
								ng-options="gs.brandname for gs in brandsselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>

						<div class="box box-info">
			              <div class="box-header with-border">
			                <h3 class="box-title">货物参数填写区域</h3>
			              </div>
			              <div class="box-body">
			              <div class="form-group" ng-repeat="gt in gtparams">
								<label>{{gt.paramname}}</label>
								<input maxlength="100" required="required" ng-model="gt.val" class="form-control" type="text" placeholder="请输入参数">
						  </div>
			              </div>
			        	</div>
						<div class="box box-info">
			              <div class="box-header with-border">
			                <h3 class="box-title">货物属性填写区域</h3>
			              </div>
			              <div class="box-body">
			              
			              	<div class="form-group" ng-repeat="attr in goodsattrs track by $index">
			              	<label>{{attr.goodsattributename}}--{{attr.sval}}</label>
									<select ng-model="attr.sval"
										ng-options="as.attrname for as in attrslist[$index]" style="width:100%;">
										<option ng－value="-1">--请选择--</option>
									</select>
							</div>
			              </div>
		        		</div>
						<div class="box box-info">
			               <div class="box-header with-border" ng-init="findallproductsku();">
			                <h3 class="box-title">货物规格填写区域</h3>
			              </div>
						<div class="box-body" >
			              <div class="col-md-3" ng-repeat="sku in skubeanlists" ng-if="sku.type==2">
				              <div class="box box-warning" >
				                <div class="box-header with-border">
				                  <div class="form-group">
				                    <label>
				                      <input type="checkbox" id="{{sku.id}}" name="psku" class="minimal" ng-checked="isSelected(sku.id)" ng-click="updateSelection($event,sku.id,sku)">
															{{sku.skuname}}:<div style="float:right;margin-left:5px;width:20px;height:20px;background-color:{{sku.skuval}}"></div>
				                    </label>
				                  </div>
				              	</div>
			              	</div>
						  </div>
              			</div>

			              <div class="box-body">
			              <div class="col-md-3" ng-repeat="sku in skubeanlists" ng-if="sku.type==1">
				              <div class="box box-warning" >
				                <div class="box-header with-border">
			                  <div class="form-group">
			                    <label>
			                      <input type="checkbox" id="{{sku.id}}"  name="psku"  class="minimal" ng-checked="isSelected(sku.id)" ng-click="updateSelection($event,sku.id,sku)">
			                      {{sku.skuname}}:{{sku.skuval}}
			                    </label>
			                  </div>
			
				              	</div>
			              	</div>
							</div>
			              </div>
		        </div>
		       		 	<div class="box-body" ng-show="skushow">
		                      <div class="form-group">
								<button class="btn btn-block btn-default"
									ng-click="addsku();">确定添加该组规格</button>
							</div>
							<div class="col-md-3" ng-repeat="gt in skuparams">
								<div class="alert alert-info alert-dismissable">
									<button ng-click="remove($index)" type="button" class="close"
										data-dismiss="alert" aria-hidden="true">&times;</button>
									<h4>
										<i class="icon fa fa-info"></i>
									</h4>
									<div class="form-group">

										<label>所选规格</label> <input maxlength="20"
											ng-model="gt.skuvals" class="form-control" type="text"
											placeholder="请输入参数名称">

									</div>
									<div class="form-group">

										<label>库存数量</label> <input maxlength="3" ng-model="gt.stock"
											class="form-control" type="number" placeholder="请输入数字">

									</div>
								</div>
							</div>
						</div>
						<div ng-show=lastcategoryshow class="form-group">
							<label>分类</label>
							<input maxlength="20" required="required"
								ng-model="lastcategory" class="form-control" type="text" readonly>
							<input type="hidden" ng-model="lastbrandid"/>
						</div>
						<div ng-show="modifycategoryshow" class="form-group">
							<button class="btn btn-default btn-block btn-sm" ng-click="clickmodifycategory();">修改分类</button>
						</div>

						<div ng-show="navcategoryshow" class="form-group" ng-init="findNavAll();">
							<label>一级分类</label>
							<select ng-change="navchange();"
								ng-model="selectednav"
								ng-options="gs.name for gs in navselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>
						<div ng-show="ltypecategoryshow" class="form-group">
							<label>二级分类</label>
							<select ng-change="ltypechange();"
								ng-model="selectedltype"
								ng-options="gs.name for gs in ltypeselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>
						<div ng-show="stypecategoryshow" class="form-group">
							<label>三级分类</label>
							<select
								ng-model="selectedstype"
								ng-options="gs.name for gs in stypeselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>


						<div class="form-group">
							<label>货号</label> <input maxlength="20" ng-model="psn"
								class="form-control" type="text" placeholder="请输入货号">
						</div>
						<div class="form-group">
							<label>库存</label> <input maxlength="20" ng-model="stock"
								class="form-control" type="text" placeholder="请输入库存">
						</div>
						<div class="form-group">
							<label>货物名称</label> <input maxlength="100" required="required"
								ng-model="productname" class="form-control" type="text"
								placeholder="请输入货物名称">
						</div>
						<div class="form-group">
							<label>重量</label> <input maxlength="20"
								ng-model="weight" class="form-control" type="text"
								placeholder="请输入重量默认千克">
						</div>
						<div class="form-group">
							<label> <input type="radio" ng-model="weightunit"
								ng-value="1" class="flat-red">千克
							</label> <label> <input type="radio" ng-model="weightunit"
								ng-value="2" class="flat-red">克
							</label>
						</div>
						<div class="form-group">
							<label>成本价格</label> <input maxlength="20" ng-model="cost"
								class="form-control" type="text" placeholder="请输入成本价格">
						</div>
						<div class="form-group">
							<label>会员价格</label> <input maxlength="20" ng-model="memberprice"
								class="form-control" type="text" placeholder="请输入会员价格">
						</div>
						<div class="form-group">
							<label>市场价格</label> <input maxlength="20" ng-model="price"
								class="form-control" type="text" placeholder="请输入市场价格">
						</div>
						<div class="form-group">
							<label>销售价格</label> <input maxlength="20" ng-model="saleprice"
								class="form-control" type="text" placeholder="请输入销售价格">
						</div>
						<div class="form-group">
							<label>可获积分</label> <input maxlength="20" ng-model="points"
								class="form-control" type="text" placeholder="请输入可获积分">
						</div>
						<div class="form-group">
							<label>预警库存</label> <input maxlength="20" ng-model="freezestock" ng-value="10"
								class="form-control" type="number" placeholder="请输入预警库存">
						</div>
						<div class="form-group">
							<label>总点赞</label> <input maxlength="20" ng-value="100"
								ng-model="totalzan" class="form-control" type="number"
								placeholder="请输入喜欢数">
						</div>
						<div class="form-group">
							<label>总评论</label> <input maxlength="20" ng-model="totalcomment" ng-value="100"
								class="form-control" type="number" placeholder="请输入总评论数量">
						</div>
						<div class="form-group">
							<label> <input type="radio" ng-model="unit"
								ng-value="1" class="flat-red">1件
							</label> <label> <input type="radio" ng-model="unit"
								ng-value="2" class="flat-red">1张
							</label>
							<label> <input type="radio" ng-model="unit"
								ng-value="3" class="flat-red">1套
							</label> <label> <input type="radio" ng-model="unit"
								ng-value="4" class="flat-red">1个
							</label>
							<label> <input type="radio" ng-model="unit"
								ng-value="5" class="flat-red">1组
							</label> <label> <input type="radio" ng-model="unit"
								ng-value="6" class="flat-red">1系列
							</label>
						</div>
						<div class="form-group">
							<label>虚拟销量</label> <input maxlength="20" ng-value="100"
								ng-model="vsales" class="form-control" type="number"
								placeholder="请输入虚拟销量">
						</div>
						<div class="form-group">
							<label>真实销量</label> <input maxlength="20" ng-value="100"
								ng-model="sales" class="form-control" type="number"
								placeholder="请输入真实销量">
						</div>
						<div class="form-group">
							<label>排序</label> <input maxlength="3" value="1"
								ng-model="sort" class="form-control" type="number"
								placeholder="请输入数字">
						</div>
						<div class="form-group">
							<label> <input type="radio" ng-model="msync"
								ng-value="1" class="flat-red" ng-checked="true">同步到移动端使用
							</label> <label> <input type="radio" ng-model="msync"
								ng-value="0" class="flat-red" >只在电脑端使用
							</label>
						</div>
						<div class="form-group">
							<label> <input type="radio" ng-model="salestatus"
								ng-value="1" class="flat-red" ng-checked="true">上架
							</label> <label> <input type="radio" ng-model="salestatus"
								ng-value="0" class="flat-red"> 下架
							</label>
						</div>
						<div class="form-group">
							<label> <input type="radio" ng-model="status"
								ng-value="1" class="flat-red" ng-checked="true"> 启用
							</label> <label> <input type="radio" ng-model="status"
								ng-value="0" class="flat-red"> 禁用
							</label>
						</div>
						<div class="form-group">
							<label>主图</label>
							<div ngf-drop ngf-select ng-model="rmainfiles" class="drop-box"
								ngf-drag-over-class="'dragover'" ngf-multiple="true"
								ngf-allow-dir="true" accept="image/*" ngf-pattern="'image/*'">
								<button class="btn btn-default btn-block btn-sm">选择文件</button>
								<div ngf-no-file-drop>File Drag/Drop is not supported for
									this browser</div>
							</div>
							<div class='box-body'>
								<div class="progress progress-sm active">
									<div
										class="progress-bar progress-bar-success progress-bar-striped"
										role="progressbar" aria-valuenow="0" aria-valuemin="0"
										aria-valuemax="100" style="width: {{rmainprogress}}%">
										<span class="sr-only">20% Complete</span>
									</div>
								</div>
								<div ng-repeat="img in allrmainfiles">
									<div ng-if="img.isCloudImg">
										<div class="alert alert-success alert-dismissable">
											<button ng-click="removeallrmainfiles($index)" type="button" class="close"
												data-dismiss="alert" aria-hidden="true">&times;</button>

											<img class="img-responsive pad"
												ng-src="{{img.normalfilepath}}" alt="Photo"> <img
												class="img-responsive pad" ng-src="{{img.compressfilepath}}"
												alt="Photo">

										</div>
									</div>
									<div ng-if="!img.isCloudImg">
										<div class="alert alert-success alert-dismissable">
											<button ng-click="removeallrmainfiles($index)" type="button" class="close"
												data-dismiss="alert" aria-hidden="true">&times;</button>

											<img class="img-responsive pad"
												ng-src="{{img.basepath+img.normalfilepath}}" alt="Photo">

											<img class="img-responsive pad"
												ng-src="{{img.basepath+img.compressfilepath}}" alt="Photo">

										</div>


									</div>
								</div>

							</div>
						</div>
						<div class="form-group">
							<label>图集</label>
							<div ngf-drop ngf-select ng-model="rfiles" class="drop-box"
								ngf-drag-over-class="'dragover'" ngf-multiple="true"
								ngf-allow-dir="true" accept="image/*" ngf-pattern="'image/*'">
								<button class="btn btn-default btn-block btn-sm">选择文件</button>
								<div ngf-no-file-drop>File Drag/Drop is not supported for
									this browser</div>
							</div>
							<div class='box-body'>
								<div class="progress progress-sm active">
									<div
										class="progress-bar progress-bar-success progress-bar-striped"
										role="progressbar" aria-valuenow="0" aria-valuemin="0"
										aria-valuemax="100" style="width: {{rprogress}}%">
										<span class="sr-only">20% Complete</span>
									</div>
								</div>
								<div ng-repeat="img in allrfiles">
									<div ng-if="img.isCloudImg">
										<div class="alert alert-success alert-dismissable">
											<button ng-click="removeallrfiles($index)" type="button" class="close"
												data-dismiss="alert" aria-hidden="true">&times;</button>

											<img class="img-responsive pad"
												ng-src="{{img.normalfilepath}}" alt="Photo"> <img
												class="img-responsive pad" ng-src="{{img.compressfilepath}}"
												alt="Photo">

										</div>
									</div>
									<div ng-if="!img.isCloudImg">
										<div class="alert alert-success alert-dismissable">
											<button ng-click="removeallrfiles($index)" type="button" class="close"
												data-dismiss="alert" aria-hidden="true">&times;</button>

											<img class="img-responsive pad"
												ng-src="{{img.basepath+img.normalfilepath}}" alt="Photo">

											<img class="img-responsive pad"
												ng-src="{{img.basepath+img.compressfilepath}}" alt="Photo">

										</div>


									</div>
								</div>

							</div>
						</div>

					</div>
					<div class="box-footer">
						<button ng-show="savebtn.show" type="button"
							class="btn btn-primary" ng-click="save();">保存</button>
						<button ng-show="updatebtn.show" type="button"
							class="btn btn-primary" ng-click="update();">更新</button>
					</div>
				</form>
			</div>
		</div>
		<div class="box-footer"></div>
	</div>
</section>
<script>
$(function(){
	$(".select2").select2();
});
</script>
</div>